<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <!-- 数据代理的演示例 -->
    <script>
        let a = {
            a1:100
        }
        let b ={
            b1:100
        }
        //接下来我们把a的a1绑定到b中,即用b来代理a的数据
        Object.defineProperty(b,"b2",{
            get(){
                return a.a1
            },
            set(value){
                a.a1=value
            }
        })
    </script>
</body>
</html>